Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ikhal] add option to disable mouse, fixes #1289 #1295

Merged
merged 8 commits into from
Oct 24, 2023

Conversation

choucavalier
Copy link
Contributor

@choucavalier choucavalier commented Sep 16, 2023

This is done by passing the handle_mouse Boolean argument to urwid's main loop (currently unused). By default, the mouse remains enabled (see khal.spec). Mouse can be disabled either by setting enable_mouse = False in the [default] section of khal's config file, or by passing the --no-mouse flag to the khal interactive or ikhal click commands.

fixes #1289

This is done by passing the `handle_mouse` Boolean argument to urwid's
main loop (currently unused). By default, the mouse remains enabled
(see `khal.spec`). Mouse can be disabled either by setting
`enable_mouse = False` in the `[default]` section of khal's config
file, or by passing the `--no-mouse` flag to the `khal interactive` or
`ikhal` click commands.
@@ -19,3 +19,4 @@ env/
venv/
.hypothesis/
.python-version
.dmypy.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this because I'm using neovim with pylsp-mypy (with the dmypy daemon, which can create this file).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections on this.

Note that you can include this in ~/.config/git/ignore and git will ignore the file for all your local repositories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks, did not know that. Good to know :)

khal/cli.py Outdated
@@ -93,6 +93,12 @@ def multi_calendar_option(f):
return d(a(f))


def no_mouse_option(f):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I had to use this both for ikhal and khal interactive, I figured it made sense to abstract this option into its own function decorator.

khal/cli.py Outdated
'''Interactive UI. Also launchable via `ikhal`.'''
if no_mouse:
ctx.obj['conf']['default']['enable_mouse'] = False
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm overriding the config value when the --no-mouse flag is used. Not sure this is the best way, but seems to work.

Copy link
Member

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me.

@choucavalier
Copy link
Contributor Author

@WhyNotHugo i fixed the tests, can you trigger the CI build (sorry was busy with work and forgot this PR)

khal/cli.py Outdated Show resolved Hide resolved
khal/cli.py Outdated Show resolved Hide resolved
khal/cli.py Outdated Show resolved Hide resolved
khal/cli.py Outdated Show resolved Hide resolved
@choucavalier
Copy link
Contributor Author

@WhyNotHugo addressed your comments (sorry for not running the tests before), ran the tests locally and everything passes. i think you can trigger the CI again!

Copy link
Member

@geier geier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, looks good. I believe setting the default of the click flag to True messes with overriding the config variable (e.g. setting the default value to False is then overridden by the command flag). See comments.

khal/cli.py Outdated Show resolved Hide resolved
khal/cli.py Outdated Show resolved Hide resolved
@choucavalier
Copy link
Contributor Author

@geier done! thanks for catching that

@geier
Copy link
Member

geier commented Oct 24, 2023

@tgy I don't see any changes, did you push?

looks like I didn't reload properly.

@geier
Copy link
Member

geier commented Oct 24, 2023

Works, thanks!

@geier geier merged commit 63c9b85 into pimutils:master Oct 24, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] allow disabling mouse input
3 participants